﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="register.aspx.cs" Inherits="register" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>果之-注册页</title>
    <link href="css/guozhi.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1">
    <div class="container">
        <!--#include file="~/common/header.htm"-->
        <script src="Scripts/gz_Validator-4.1.1.js" type="text/javascript" charset="UTF-8"></script>
        <script src="Scripts/gz_ValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
        <script src="Scripts/gz_Customer.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                LoadDeliveryarea();
                BindPageSelEvent();
                $.formValidator.initConfig({ theme: "126", formID: "form1",
                    ajaxForm: { url: "/ajax/ajaxcustomer.ashx", data: { "methodName": "CustomerReg" }, type: "POST", // buttons: $("#btnReg"), 
                        dataType: "text",
                        success: function (data) {

                            if (data.indexOf("注册成功!") > 0) {
                                cleaner.toEmpty();
                                window.location.href = "success.aspx";
                            }
                        },
                        beforeSend: function () {
                            if ($("#sel_RegionId").val() == "-1") { alert("请选择区!"); return false; }
                            else if ($("#sel_BusinessDistrictId").val() == "-1") { alert("请选择商圈!"); return false; }
                            else if ($("#sel_OfficeId").val() == "-1") { alert("请选择中心区!"); return false; }
                            else if ($("#sel_FloorId").val() == "-1") { alert("请选择楼层!"); return false; }
                        }
                    },
                    onError: function (msg) { alert(msg); },
                    submitAfterAjaxPrompt: '有数据正在异步验证，请稍等...'
                });

                $("#txt_Email").formValidator({ onShowFixText: "6~18个字符，包括字母、数字、下划线，以字母开头，字母或数字结尾", onShow: "请输入邮箱", onFocus: "邮箱6-100个字符,输入正确了才能离开焦点", onCorrect: "", defaultValue: "" })
                .inputValidator({ min: 6, max: 100, onError: "你输入的邮箱格式不符合要求,请确认" })
                .regexValidator({ regExp: "^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", onError: "你输入的邮箱格式不正确" })
                        	  .ajaxValidator({
                        	      dataType: "html",
                        	      type: "post",
                        	      async: true,
                        	      url: "ajax/ajaxcustomer.ashx",
                        	      data: { methodName: "CustomerIsEffective", txt_Email: $.trim($("#txt_Email").val()) },
                        	      success: function (res) {
                        	          var data = res;
                        	          if (data.indexOf('此邮箱可以注册!') > -1) {
                        	              return true;
                        	          }
                        	          return data;
                        	      },
                        	      buttons: $("#button"),
                        	      error: function (jqXHR, textStatus, errorThrown) { alert("服务器没有返回数据，可能服务器忙，请重试" + errorThrown); },
                        	      onError: "该邮箱不可用，请更换邮箱",
                        	      onWait: ""
                        	  });


                $("#txt_PWD").formValidator({ onShowFixText: "6~16个字符，包括字母、数字、特殊符号，区分大小写", onShow: "请输入密码", onFocus: "至少1个长度", onCorrect: "密码合法" })
            .inputValidator({ min: 6, max: 16, empty: { leftEmpty: false, rightEmpty: false, emptyError: "密码两边不能有空符号" }, onError: "密码长度应该为6至16位,请确认" })
            .passwordValidator({ compareID: "txt_Email" });
                $("#txt_RepPWD").formValidator({ onShowFixText: "请再次输入密码", onShow: "输再次输入密码", onFocus: "至少1个长度", onCorrect: "密码一致" }).inputValidator({ min: 1, empty: { leftEmpty: false, rightEmpty: false, emptyError: "重复密码两边不能有空符号" }, onError: "重复密码不能为空,请确认" }).compareValidator({ desID: "txt_PWD", operateor: "=", onError: "2次密码不一致,请确认" });
                $("#txt_CustomerName").formValidator({ onShowFixText: "请您说输入汉字", onShowText: "", onShow: "请输入用户名", onCorrect: "该用户名可以注册" }).inputValidator({ min: 2, max: 12, onError: "你输入的用户长度不正确,请确认" })

                $("#txt_TelNum").formValidator({ onShowFixText: "密码遗忘或被盗时，可通过手机短信取回密码", onShow: "请输入手机号码", onFocus: "手机的长度必须是11位", onCorrect: "格式正确" })
                    .inputValidator({
                        min: 8, max: 11, onError: "输入座机或者手机号码长度不正确!"
                    });
                $("#txt_Address").formValidator({ onShowFixText: "", onShowText: "", onShow: "请输入您的收货地址", onFocus: "描述至少要输入", onCorrect: "", defaultValue: "" });


            })
            var cleaner =
             {
                 toEmpty: function () {
                     $("#txt_Email").val("");
                     $("#txt_PWD").val("");
                     $("#txt_RepPWD").val("");
                     $("#txt_CustomerName").val("");
                     $("#txt_TelNum").val("");
                     $("#txt_Memo").val("");
                     $("#sel_RegionId").val("-1");
                     $("#sel_OfficeId").val("-1");
                     $("#sel_FloorId").val("-1");
                     $("#sel_BusinessDistrictId").val("-1");
                 }
             };
        </script>
        <!--#include file="~/common/quickBuy.htm"-->
        <div class="register">
            <div>
                <img alt="" src="images/gz_zc_05.gif" width="187" height="74" /></div>
            <div class="table1">
                <table width="770" cellspacing="0">
                    <tbody>
                        <tr>
                            <td class="style1">
                                注册邮件地址 / Email
                            </td>
                            <td class="style2">
                                <input id="txt_Email" type="text" name="txt_Email" autocomplete="off" /><div id="txt_EmailTip"
                                    style="width: 280px; float: right;">
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                登录密码 / Password
                            </td>
                            <td class="style2">
                                <input id="txt_PWD" type="password" name="txt_PWD" autocomplete="off" /><div id="txt_PWDTip"
                                    style="width: 280px; float: right;">
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="style1">
                                确认登录密码 / Password
                            </td>
                            <td class="style2">
                                <input id="txt_RepPWD" type="password" name="txt_RepPWD" autocomplete="off" /><div
                                    id="txt_RepPWDTip" style="width: 280px; float: right;">
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div class="peisong">
                <img src="images/gz_zc_11.gif" width="187" height="33" /></div>
            <div class="table2">
                <table width="770" cellspacing="0">
                    <tr>
                        <td class="style1">
                            姓名 / Name
                        </td>
                        <td class="style2">
                            <input id="txt_CustomerName" type="text" name="txt_CustomerName" autocomplete="off" /><div
                                id="txt_CustomerNameTip" style="width: 280px; float: right;">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            电话/手机 / Phone/Mobile
                        </td>
                        <td class="style2">
                            <input id="txt_TelNum" type="text" name="txt_TelNum" autocomplete="off" /><div id="txt_TelNumTip"
                                style="width: 280px; float: right;">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            配送区域 / Delivery area
                        </td>
                        <td class="style2">
                            <select id="sel_RegionId" name="sel_RegionId">
                            </select><select id="sel_BusinessDistrictId" name="sel_BusinessDistrictId">
                            </select><select id="sel_OfficeId" name="sel_OfficeId">
                            </select><select id="sel_FloorId" name="sel_FloorId">
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="style1">
                            公司名称/ Company
                        </td>
                        <td class="style2">
                            <input id="txt_Address" type="text" name="txt_Address" autocomplete="off" /><div
                                id="txt_AddressTip" style="width: 280px; float: right;">
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="zhuce">
                <input id="btnReg" type="submit" value="" style="background-image: url(images/gz_zc_41.gif);
                    height: 34px; width: 91px; border: 0px;" />
            </div>
        </div>
        <!--#include file="common/bottom.htm"-->
    </div>
    </form>
</body>
</html>
